<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/tld/security.tld" prefix="s" %>

<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript">
function submitCornFuturesVersionsQuery(form, orderField, orderType){
		form.orderField.value = orderField;
		form.orderType.value = orderType;
		form.action = "cornFuturesVersionsQuery.do";
		if (validSubmit){
			form.submit();
		} else {
			alert('<fmt:message key="warning.message.common.processing"/>');
		}
	}
</script>
<html:form action="/cornFuturesVersionsQuery" method="POST">
	<input type="hidden" id="versionId" name="versionId" value='<bean:write name="versionId"/>'>
	<html:hidden property="orderField"/>
	<html:hidden property="orderType"/>
	<html:hidden property="versionId"/>
</html:form>
<table align="center" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
	<tr>
		<td class="titulocolumna" align="center" width="20">
			<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERFUTUR" nombreCortoEnt="NEW" permiso="ADMINISTRACION">
				<html:link action="/cornFuturesVersionsGoAdd.do"><img alt="<bean:message key="label.common.add"/> <bean:message key="label.versions.futurePurchases"/>" src="images/nuevo.gif" border="0"></html:link>
			</s:entidad>
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 0,'<c:choose><c:when test="${previousOrderField == 0 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="message.futurepurchase.periodaccount"/>
				<c:choose>
					<c:when test="${previousOrderField == 0 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 0 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>		
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 1, '<c:choose><c:when test="${previousOrderField == 1 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="message.futurepurchase.periodapplication"/>
				<c:choose>
					<c:when test="${previousOrderField == 1 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 1 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 2, '<c:choose><c:when test="${previousOrderField == 2 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.futurepurchase.query.quantity"/>
				<c:choose>
					<c:when test="${previousOrderField == 2 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 2 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>
		</td>
		
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 3, '<c:choose><c:when test="${previousOrderField == 3 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.futurepurchase.query.unitPrice"/>
				<c:choose>
					<c:when test="${previousOrderField == 3 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 3 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 4, '<c:choose><c:when test="${previousOrderField == 4 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.futurepurchase.query.price"/>
				<c:choose>
					<c:when test="${previousOrderField == 4 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 4 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitCornFuturesVersionsQuery(document.CornFuturesVersionsQueryForm, 5, '<c:choose><c:when test="${previousOrderField == 5 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.futurepurchase.query.origin"/>
				<c:choose>
					<c:when test="${previousOrderField == 5 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 5 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>		
		<td width="20" class="titulocolumna" align="center">&nbsp;</td>		
	</tr>
	<logic:notEmpty name="cornFuturesVersionsList">
		<logic:iterate id="row" name="cornFuturesVersionsList" indexId="int_i">
			<tr class="<%=((int_i.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">							
				<td align="center">
					<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERFUTUR" nombreCortoEnt="EDIT" permiso="ADMINISTRACION">
						<html:link action="/cornFuturesVersionsGoEdit.do" paramId="cornFuturesVersionsId" paramName="row" paramProperty="cornFutureVersionId"> <img alt="<bean:message key="common.edit"/> <bean:write name="row" property="accountFuturePeriodVersionDescription"/>" src="images/modificar.gif" border="0"> </html:link>
					</s:entidad>
				</td>							
				<td align="center"><bean:write name="row" property="accountFuturePeriodVersionDescription"/></td>
				<td align="center"><bean:write name="row" property="applicationFuturePeriodVersionDescription"/></td>
				<td align="right"><bean:write name="row" property="quantity"/></td>
				<td align="right"><c:if test="${row.unitPrice != 0.0}"><bean:write name="row" property="unitPrice"  format="#,##0.0000"/></c:if></td>						
				<td align="right"><c:if test="${price != 0.0}"><bean:write name="row" property="price"  format="#,##0.0000"/></c:if></td>
				<td align="right">
				<c:choose>
					<c:when test="${row.cornOrigin != 'N'}">
						<bean:message key="label.futurepurchase.query.origin.imported"/>
					</c:when>
					<c:otherwise>
						<bean:message key="label.futurepurchase.query.origin.national"/>
					</c:otherwise>
				</c:choose>				
				</td>
				<td align="center">
					<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERFUTUR" nombreCortoEnt="DELETE" permiso="ADMINISTRACION">
						<a href="#>" onclick="if( confirmDelete('<bean:write name="row" property="accountFuturePeriodVersionDescription"/>') )location.href='cornFuturesVersionsDel.do?cornFuturesVersionsId=<bean:write name="row" property="cornFutureVersionId"/>';"><img alt="<bean:message key="common.delete"/>  <bean:write name="row" property="accountFuturePeriodVersionDescription"/>" src="images/eliminar.jpg" border="0"></a>
					</s:entidad>
				</td>
			</tr>
		</logic:iterate>
	</logic:notEmpty>
</table>
<br />
<br />